#include "handler_factory.h"

handler::handler_factory::~handler_factory()
{
	_multi.reset();
	_con_mgr.reset();
}

void handler::handler_factory::build()
{
	boost::shared_ptr<network::message_queue> q(new network::message_queue);
	_con_mgr.reset(new network::connection_manager(q));
	_multi = handler::multicaster::create(q);
}


boost::shared_ptr<handler::multicaster> handler::handler_factory::
							get_multicaster()
{
	if(_multi.get() == 0) {
		throw std::runtime_error("error, execute build first");
	}
	return _multi;
}

boost::shared_ptr<network::connection_manager> 
			handler::handler_factory::get_connection_manager()
{
	if(_con_mgr.get() == 0) {
		throw std::runtime_error("error, execute build first");
	}
	return _con_mgr;
}

